package com.cw.controller;


import com.cw.annotation.*;
import com.cw.common.api.Response;
import com.cw.common.api.ResultObject;
import com.cw.common.constant.*;
import com.cw.dto.InpatientRegistrationCondition;
import com.cw.entity.*;
import com.cw.request.AllSickBedsRequest;
import com.cw.service.*;
import io.swagger.annotations.*;

import java.util.*;

import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ly
 * @since 2024-02-19
 */
@Api(tags = {"预绑定患者信息表"})
@RestController
@RequestMapping("/patient-bed-middle-prebundled")

public class PatientBedMiddlePrebundledController {

    @Autowired
    private IPatientBedMiddlePrebundledService targetService;


    @ApiOperation(value = "床位预绑定-床位ID、病人ID、病人姓名")
    @OperationLogAnno(site = "床位预绑定列表", operation = "未预约->预绑定", bz = "门诊办人员操作",
            method = "/patient-bed-middle-prebundled/addPrebundled", type = "INSERT")
    @PostMapping("/addPrebundled")
    public com.cw.common.api.Response addPrebundled(
            @RequestParam String bedId, @RequestParam String patientId, @RequestParam String name) {
        return targetService.addPrebundled(bedId, patientId, name);
    }


    @ApiOperation(value = "取消预绑定-床位ID、病人ID")
    @PostMapping("/updatePrebundled")
    @OperationLogAnno(site = "床位预绑定列表", operation = "预绑定->取消预绑定", bz = "门诊办人员操作",
            method = "/patient-bed-middle-prebundled/updatePrebundled", type = "UPDATE")
    public Response updatePrebundled(@RequestParam String bedId, @RequestParam String patientId) {
        return targetService.updatePrebundled(bedId, patientId);
    }


    @ApiOperation(value = "取消预绑定-床位ID、病人姓名")
    @PostMapping("/unbind")
    @OperationLogAnno(site = "床位预绑定列表", operation = "预绑定->取消预绑定", bz = "门诊办人员操作",
            method = "/patient-bed-middle-prebundled/unbind", type = "UPDATE")
    public Response unbind(@RequestParam String bedId, @RequestParam String name) {
        return targetService.unbind(bedId, name);
    }

    @AutoYard
    @ApiOperation(value = "获取预绑定病区")
    @PostMapping("/listPreBoundWard")
    public ResultObject listPreBoundWard(@RequestBody AllSickBedsRequest param) {
        return ResultObject.successReturn(targetService.listPreBoundWard(param));
    }


    @ApiOperation(value = "获取预绑定床位详情")
    @PostMapping("/getPreBoundBedDetail")
    public ResultObject getPreBoundBedDetail(@RequestBody AllSickBedsRequest param) {
        return ResultObject.successReturn(targetService.getPreBoundBedDetail(param));
    }


    @ApiOperation(value = "预绑定患者转为真实绑定、病人ID、床位号")
    @PostMapping("/updateTrueBinding")
    @OperationLogAnno(site = "床位预绑定列表", operation = "预绑定->真实绑定", bz = "护士站患者出院自动调用",
            method = "/patient-bed-middle-prebundled/updateTrueBinding", type = "UPDATE")
    public Response updateTrueBinding(@RequestParam String bedNo) {
        return targetService.updateTrueBinding(bedNo);
    }

    @AutoYard
    @ApiOperation("预绑定---页签")
    @PostMapping("/getThisIiPrepayinPrebundled")
    public ResultObject getThisIiPrepayinPrebundled(@RequestBody InpatientRegistrationCondition condition) {
        return ResultObject.successReturn(targetService.getThisIiPrepayinPrebundled(condition));
    }

}

